<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserInfosTable extends Migration
{
    /**
     * Run the migrations.
     * 前台用户详情表
     * @return void
     */
    public function up()
    {
        Schema::create('user_infos', function (Blueprint $table) {
            $table->increments('id');
            $table->Integer('user_id');
            $table->string('nickname')->unique();
            $table->string('email')->nullable();
            $table->tinyInteger('sex')->nullable();
            $table->string('address')->default('0,0,0');
            $table->string('avatar')->nullable()->default('/images/80x80.png');
            $table->string('following')->nullable();
            $table->string('fans')->nullable();
            $table->string('favorites')->nullable();
            $table->string('likes')->nullable();
            $table->string('bgd')->default('/images/background/4.jpeg');
            $table->string('last_ip',20)->nullable();
            $table->timestamp('last_login_at')->nullable();
            $table->index('user_id');
            $table->index('nickname');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_infos');
    }
}
